package com.pine.app.module.security.oauth.provider;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Set;

/**
 * @author xiaoyuan
 * @create 2020/3/10 23:08
 **/
@Data
@AllArgsConstructor
public class DefaultOAuth2ClientRequest implements OAuth2ClientRequest {

    private String clientId;


    private String clientSecret;

    private String clientName;


    private Set<String> scope;

    private Set<String> resources;

    private Set<String> roles;
    private String grantType;

    private Integer accessTokenValiditySeconds;

    private Integer refreshTokenValiditySeconds;


    @Override
    public boolean isScoped() {
        return this.scope != null && !this.scope.isEmpty();
    }

    public Integer getAccessTokenValiditySeconds() {
        return accessTokenValiditySeconds;
    }

    public Integer getRefreshTokenValiditySeconds() {
        return refreshTokenValiditySeconds;
    }
}
